package com.example.demo.one2many;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("one2many")
public class One2ManyController {

    @Autowired
    private OneSender oneSender1;
    @Autowired
    private OneSender oneSender2;

    @GetMapping("one2Many")
    public String one2Many(String message) {
        long currentTimeMillis = System.currentTimeMillis();
        oneSender1.send(message+" "+currentTimeMillis);
        oneSender2.send(message+" "+currentTimeMillis);
        return message;
    }
}
